/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.utfpr.controlador;

import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.edu.utfpr.bean.Usuario;
import br.edu.utfpr.dao.DaoCliente;

/**
 *
 * @author guardezi
 */

@Resource
public class IndexController {
    private final Result result;
    private final DaoCliente dao;
    

    public IndexController(Result result, DaoCliente dao) {
        this.result = result;
        this.dao = dao;
    }
    
    @Path("/")
    public void login(){
        //result.include("welcome","Passagens Aereas <br/>Seja Bem Vindo! ");

    }
    
    @Post
    @Path("/login")
    public void logar(Usuario u){
        if(u.getUsername().equalsIgnoreCase("admin")&& u.getPassword().equalsIgnoreCase("admin"))
            result.forwardTo(this).index();
        else
            result.forwardTo(this).login();
    }
    
    
    @Path("/index")
    public void index(){
        result.include("welcome","Passagens Aereas <br/>Seja Bem Vindo! ");

    }
    
}